<?php

/*
  Action	$2

  +1 Action
  Reveal 4 cards from your deck. Either discard them all, or discard your entire hand and take the cards you revealed.

 */

class Respawn extends Card implements iAction, iKingdom, iAddiction {

    public function __construct() {
        parent::__construct("Respawn", 2);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+1 Action",
            "Reveal 4 cards from your deck. Either discard them all, or discard your entire hand and take the cards you revealed.");
    }

    public function play(Game $game, $isRealCard) {
        $game->addActions(1);
        ScreenDisplay::addScreenMessage($game, true, "get +1 action", "gets +1 action");

        $drawed_cards = $game->removeCardsFromDrawDeck(4);
        ScreenDisplay::addScreenMessage($game, true, " reveal " . nicePrint($drawed_cards), " reveals ".ScreenDisplay::$LMSG);

        $options = array(new Option(1, "Discard revealed cards"), new Option(2, "Discard hand and take revealed cards"));

        $output = MySocket::GetUserReply($game, Input_ChooseOne, $options, 1, 1, null, "You peek on ". niceReadableString($game, $drawed_cards).". Please choose");
        $answer = $output[0];
        if ($answer == 'Discard revealed cards') {
            $game->discardTempDiscardCards($drawed_cards);
            ScreenDisplay::addScreenMessage($game, false, " and discard them", " and discards them");
        } else {
            $game->discardPlayHand();
            $game->putCardsInPlayHand($drawed_cards);
            ScreenDisplay::addScreenMessage($game, false, " and put them in your hand", " and puts them is his hand");
        }
        $game->cardActionFinished();
        return true;
    }

}

?>